package domin;

import lombok.Getter;
import lombok.Setter;
import util.IdService;

import java.io.Serializable;


@Setter
@Getter
public class Library implements Comparable<Library>, Serializable {

    private Integer id;

    private String no;

    private String name;

    private String remarks;
    {
        this.id = IdService.getId();
    }
    public Library(){

    }

    public Library(int id, String no, String name, String remarks) {
        this.id = id;
        this.no = no;
        this.name = name;
        this.remarks = remarks;
    }

    public Integer getId() {
        return id;
    }
    @Override
    public int compareTo(Library o) {
        // TODO Auto-generated method stub
        return this.id-o.id;
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((id == null) ? 0 : id.hashCode());
        return result;
    }
    @Override
    public String toString()
    {
        final String TAB = "    ";

        String retValue = "";

        retValue = "library( "
                + super.toString() + TAB
                + "id = " + this.id + TAB
                + "name = " + this.name + TAB
                + " )";

        return retValue;
    }

    public void setId(int id) {
        this.id=id;
    }

    public void setno(String no) {
        this.no=no;
    }

    public void setname(String name) {
        this.name=name;
    }

    public void setremarks(String remarks) {
        this.remarks=remarks;
    }
}
